package com.xmim.fulcrum.session;

import com.xmim.core.container.AbstractServerContainer;
import com.xmim.core.container.ServerContainer;
import com.xmim.core.exception.ContainerException;
import com.xmim.fulcrum.FulcrumFactory;
import com.xmim.fulcrum.node.FulcrumServiceNode;

public abstract class AbstractFulcrumSession<N, H> extends AbstractServerContainer<N, H> implements FulcrumSession<N, H> {


    protected FulcrumServiceNode node;

    public AbstractFulcrumSession(FulcrumFactory factory, ServerContainer parent, FulcrumServiceNode node) {
        super(factory, parent);
        this.node = node;
    }

    @Override
    public AbstractFulcrumSession<N, H> addHandler(N type, H handler) {
        super.addHandler(type, handler);
        return this;
    }

    @Override
    public AbstractFulcrumSession<N, H> start() throws ContainerException {
        super.start();
        return this;
    }

    @Override
    public AbstractFulcrumSession<N, H> close() throws ContainerException {
        super.close();
        return this;
    }


    @Override
    public ServerContainer getParent() {
        return (ServerContainer) super.getParent();
    }

    @Override
    public FulcrumServiceNode getNode() {
        return node;
    }

    @Override
    public FulcrumFactory getFactory() {
        return (FulcrumFactory) super.getFactory();
    }

}
